<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>artTemplate</title>
    <link rel="stylesheet" href="css/public/base.css">
    <script src="js/public/template.min.js"></script>
    <script src="js/public/jquery-1.9.0.min.js"></script>
</head>
<body>

<br><br>
<script id="headerTpml" type="text/html">
    <div class="logo"><a href="index.html">neikvon</a></div>
    <div class="nav_container">
        <div id="j_current_bg" class="current_bg">
            <div class="current_label"></div>
        </div>
        <ul class="nav">
        <% for( var i=0; i<list.length; i++){ %>
            <% if(list[i].subpages){ %>
            <li class="nav_item mulit"><a href="<%= list[i].href %>"><%= list[i].name %></a>
                <ul class="sub_nav">
                    <% for( var j=0; j<list[i].subpages.length; j++){ %>
                        <li class="nav_item"><a href="<%= list[i].subpages[j].href %>"><%= list[i].subpages[j].name %></a></li>
                    <% } %>
                </ul>
            <% }else{ %>
            <li class="nav_item"><a href="<%= list[i].href %>"><%= list[i].name %></a>
            <% } %>
            </li>
        <% } %>
        </ul>
    </div>
    <div class="nav_slide_trigger">-- --</div>
    <div class="slide_tips">
        <br>收<br>衣<br>服<br>啦<br>~
    </div>
</script>
<script>
    var html = template('headerTpml', {
        list: [
            {  name: '首页', href: 'index.html' },
            {  name: '博文', href: 'blog.html', subpages: [
                { name: 'html5', href: 'html5.html' },
                { name: 'css3', href: 'css3.html' },
                { name: '前端规范', href: 'manual.html' },
                { name: 'javascript', href: 'javascript.html' },
                { name: 'PS', href: 'ps.html' },
                { name: 'UX icon font', href: 'UXiconFont.html' }
            ] },
            {  name: 'personal', href: 'personal.html' },
            {  name: 'fun', href: 'fun.html' },
            {  name: '关于', href: 'about.html' }
        ]
    });
    document.write(html);
    //$('#headerTpml').html(html);
    //alert($('#headerTpml').html());
    //$('#header').html($('#headerTpml').val());
</script>
<div id="header" style="width: 160px;"></div>

</body>
</html>